#define _CRT_SECURE_NO_WARNINGS 1
#include<algorithm>

using namespace std;
#include"stack.h"
#include"queue.h"

int removeDuplicates(vector<int>& nums) {
    /*auto it = nums.begin() + 1;
    while (it != nums.end())
    {
        if (*it == *(it - 1))
            it = nums.erase(it);
        else
            ++it;
    }
    return nums.size();*/
    int n = nums.size();
    if (n == 0)
        return 0;
    int slow = 1, fast = 1;
    while (fast < n)
    {
        if (nums[fast] != nums[fast - 1])
            nums[slow++] = nums[fast];
        ++fast;
    }
    return slow;
}


int MoreThanHalfNum_Solution(vector<int>& numbers) {
    vector<int> hash(50000, 0);
    size_t n = numbers.size();
    for (auto e : numbers)
    {
        ++hash[e];
    }
    for (size_t i = 0; i < n; i++)
    {
        if (hash[numbers[i]] > n / 2)
            return numbers[i];
    }
    return 0;
}

int maxArea(vector<int>& height) {
    int left = 0, right = height.size() - 1;
    int ans = 0;
    while (left != right)
    {
        int v = min(height[left], height[right]) * (right - left);
        ans = max(ans, v);
        if (height[left] <= height[right])
            ++left;
        else
            --right;
    }
    return ans;
}

void test_heap()
{
    int arr[10] = { 1,3,2,5,4,6,8,9,7 };
    make_heap(arr, arr + 10, greater<int>());
    sort_heap(arr, arr + 10, greater<int>());
    for (auto e : arr)
    {
        cout << e << " ";
    }
    cout << endl;
}


int main()
{
    x::stack<int> st;
    st.push(1);
    st.push(2);
    st.push(3);
    st.pop();
    st.pop();
    cout << st.top() << endl;
    x::queue<int> q;
    q.push(1);
    q.push(2);
    q.push(3);
    q.pop();
    q.pop();
    cout << q.top() << endl;
}

